package xj.graph2d.app;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractButton;

import xj.graph2d.SimpleDrawView;

public class ToolSelectionListener extends DrawAction implements ActionListener {

  public void actionPerformed(ActionEvent e) {
    if (e != null) {
      Object src = e.getSource();
      if (src != null && src instanceof AbstractButton) {
	AbstractButton b = (AbstractButton) src;
	SimpleDrawView view = main.getView();
	String cmd = b.getActionCommand();
	if ("Delete".equals(cmd)) {
	  main.cut();
	} else {
	  view.setCurrentTool(cmd);
	}

	main.displayHelpMessage(cmd + ".message");

      }
    }
  }

}
